function getCookie(cookie_name) {
	var allcookies = document.cookie;
	var cookie_pos = allcookies.indexOf(cookie_name);
	if(cookie_pos != -1) {
		cookie_pos += cookie_name.length + 1; //容易出问题。。。
		var cookie_end = allcookies.indexOf(";", cookie_pos);
		if(cookie_end == -1) {
			cookie_end = allcookies.length;
		}
		var value = unescape(allcookies.substring(cookie_pos, cookie_end)); //得到cookie的值。。。
	}
	return value;
}

// 调用函数
var cookie_val = getCookie("ApiAuth");
var index_id = getCookie("index_id");
var MyUser_id = getCookie("MyUser_id");
var Business_id = getCookie("Business_id");
var statis_id = getCookie("statis_id");
var service_id = getCookie("service_id");
var oganization_id = getCookie("oganization_id");
var Resour_id = getCookie("Resour_id");
var Account_id = getCookie("Account_id");
var role_id = getCookie("role_id");
var floor = getCookie("floor");
var zxh = getCookie("zxh");
var Herf_id = getCookie("Herf_id");
var Stati_id = getCookie("Stati_id");

function Location_() {
	if(cookie_val == undefined) {
		window.location.href = "login.html";
	}
}

//删除cookie
function clearCookie() {
	var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
	if(keys) {
		for(var i = keys.length; i--;)
			document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString()
	}
	window.location.reload();
}
//获取指定ID的DOM元素
function id(obj) {
	return document.getElementById(obj);
}
//把留言板、footer节点插入页面上
//id("header").innerHTML = messageStr;
if(index_id == '1000') {
	$('.index_header').removeClass('hide');
	$('.commons_son').removeClass('commons');
	$('.dengluye').css('display', 'none')
}
if(MyUser_id == '1001') {
	$('.MyUser_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(Business_id == '1002') {
	$('.Business_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(service_id == '1004') {
	$('.Service_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(statis_id == '1003') {
	$('.statis_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(oganization_id == '1010') {
	$('.Oganization_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(Account_id == '1006') {
	$('.Account_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}

if(Resour_id == '1016') {
	$('.Resour_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}
if(Stati_id == '1030') {
	$('.Statistical_header').removeClass('hide');
	$('.commons_son').removeClass('commons')
}